﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;

namespace BN.Data
{
    public class CredentialManager
    {
        public static bool verifyLogin(string username,string password)
        {
            bool FoundUser = false;
            
            BN.DataContext.BNDataContext context = new DataContext.BNDataContext();            
       //     System.Data.Linq.Table<BN.DataContext.Authentication> authenticationtable = context.GetTable<BN.DataContext.Authentication>();

            var result = from auth in context.Authentications
                         where auth.Email == username &&
                         auth.Password == password
                         select auth;

         /*   var  = from authentication in authenticationtable
                         where authentication.Email == username
                         select authentication;*/

            if (result.Count() != 0)
            {
                FoundUser = true; 
            }

            return FoundUser;

        }
        
    }
}
